Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sunburst): add innerRadiusRatio, renderRootNode prop to control size of inner circle #1794

Closed
wants to merge 14 commits into from

Conversation

adamberro
Copy link
Contributor

@adamberro adamberro commented Oct 7, 2021

  • Adds a prop similar to the pie chart's innerRadius prop to change the size of the sunburst chart's inner circle.
  • Adds a prop to render the root node in the center of the chart.

Fixes #1649

Please let me know if this approach works or if it would be more desirable to give more flexibility such as the option to configure the type of d3 scale, or if there are any other issues or anything else is missing.

2021-10-06 16 10 27

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 7, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0c1643e:

Sandbox Source
plouc/nivo Configuration

@adamberro adamberro changed the title feat(sunburst): add innerRadiusRatio prop to control size of inner circle feat(sunburst): add innerRadiusRatio, renderRootNode prop to control size of inner circle Oct 14, 2021
@adamberro
Copy link
Contributor Author

Hi @plouc, anything we can do to get the review process started? Thank you!

@vicaub
Copy link

vicaub commented Nov 16, 2021

I really like this feature and need it on my project too!
But probably it would look better if all layer had the same radius length


const maxDepth = Math.max(...sortedNodes.map(n => n.depth))

const scale = d3ScaleRadial().domain([0, maxDepth]).range([innerRadiusOffset, radius])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using d3 scaleLinear instead of scaleRadial would render better in my opinion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scaleLinear looks quite different from the original implementation:
Screen Shot 2021-11-26 at 9 57 09 AM

Maybe we could update the sunburst props to include setters for the arc inner/outer radii. I'm not sure if this reaches a happy medium between customizability and ease of use, but my initial thought for the api would be something like:

type GetInnerRadius = (currentNode: HierarchyRectangularNode<RawDatum>, nodes: HierarchyRectangularNode<RawDatum>[]) => number

@plouc Thoughts on this approach?

@adamberro
Copy link
Contributor Author

Hi @plouc, just checking in on whether we might be able to merge this. I'm happy to make any changes as needed. Thanks!

@@ -45,6 +45,11 @@ export const useArcCentersTransition = <Datum extends DatumWithArc, ExtraProps =
mode: ArcTransitionMode = 'innerRadius',
extra?: TransitionExtra<Datum, ExtraProps>
) => {
// center label of root node
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This centers the root most label. Not sure if there is a more proper way to handle this, but I don't think it was accounted for originally

Screen Shot 2021-11-26 at 9 09 56 AM
.

@plouc
Copy link
Owner

plouc commented Dec 7, 2021

@adamberro, sorry for the late reply, I'll try to run this branch locally and review the PR in the upcoming weeks.

@lers92
Copy link

lers92 commented Mar 8, 2022

Also looking forward to this new feature 😄

@stale
Copy link

stale bot commented Jun 10, 2022

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the stale label Jun 10, 2022
@tkonopka
Copy link
Contributor

bump

@stale stale bot removed the stale label Jun 10, 2022
@rnsv
Copy link

rnsv commented Aug 12, 2022

bump

@plouc this is a great feature. Can it be reviewed and merged?

@adamberro Looks like your MR is stale. would you mind resubmitting with the latest changes?

@TotomiEcio
Copy link

Hi! I hope this MR is able to merge. I would like this changes. Thank you

@stale
Copy link

stale bot commented Nov 19, 2022

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the stale label Nov 19, 2022
@stale
Copy link

stale bot commented Nov 26, 2022

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sunburst: add props.innerRadius similar to how Pie works
7 participants